<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FancyUpload Demo by unijimpe</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/Swiff.Uploader.js"></script>
<script type="text/javascript" src="js/Fx.ProgressBar.js"></script>
<script type="text/javascript" src="js/FancyUpload2.js"></script>
<script type="text/javascript">
window.addEvent('load', function() {
	var swiffy = new FancyUpload2(
		$('demo-status'), 
		$('demo-list'), 
		{
			'url': 'upload.php',
			'fieldName': 'archivo',
			'path': 'Swiff.Uploader.swf'
		}
	);
	$('bt-browse').addEvent('click', function(){
		swiffy.browse();
		return false;
	});
	$('bt-upload').addEvent('click', function(){
		swiffy.upload();
		return false;
	});
});


function cargar_foto_actual(){

	var foto_subida = "";
	
	if($('fotosubida')){
		foto_subida = $('fotosubida').src
		foto_subida = foto_subida.split("/");
		foto_subida = foto_subida[foto_subida.length - 1 ];
	
		poner_encapa(foto_subida)
	}
	
}

function cancelar(){

   var valor_anterior_img = window.parent.document.getElementById("img").value
   if(valor_anterior_img){
      poner_encapa(valor_anterior_img);
   }else{
      poner_encapa("")   ;
   }
   
}

function poner_encapa(foto_subida){


	var html = '';
	
	html += '<div id="campo_foto" >';
	if(foto_subida)
	   html += '<img src="../FancyUpload/files/' +  foto_subida +'" width=110 height=130 />';	
	else	   
	   html += '<img src="../FancyUpload/siluetaEidher.gif" width=110 height=130 />';	   	
	html += '<div onclick="cargar_mant_fotos();" >Subir Foto</div>';
	html += '<div onclick="quitarFotos()" >Quitar Foto</div>';	
	html += '</div>';
	
 	window.parent.document.getElementById("img").value = foto_subida;
    window.parent.document.getElementById("procesos_fotos").innerHTML = html;

}



</script>
</head>
<body  marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" >

<div id="demo-status" class="hide">
	<p>
		<a href="#" id="bt-browse">Buscar archivos</a> |
		<a href="#" id="bt-upload">Subir</a> |	
		<a href="#" onclick="cargar_foto_actual()">Aceptar</a>
		<a href="#" onclick="cancelar()">Cancelar</a> </p>
	<div>
		<strong class="overall-title">El progreso global</strong><br />
		<img src="img/bar.gif" class="progress overall-progress" />	</div>
	<div>
		<strong class="current-title">Archivo Progreso</strong><br />
		<img src="img/bar.gif" class="progress current-progress" />	</div>
	<div class="current-text"></div>

<ul id="demo-list">
</ul>	
	
</div>

</body>
</html>
